home *** CD-ROM | disk | FTP | other *** search
/ L' Effet Pommier 3 / L'Effet Pommier - Volume 03.iso / Programmation / Alpha ƒ / Tcl / SystemCode / paths.tcl < prev    next >
Text File  |  1996-01-12  |  3KB  |  92 lines

  1.  
  2. # Any directory must have 'folder' somewhere in the comment.
  3. set pathComments(texPath)        "TeX application"
  4. set pathComments(TeXInputs)        "TeX Inputs folder"
  5. set pathComments(bibtexPath)    "BibTeX"
  6. set pathComments(cdPath)        "CodeWarrior Debugger"
  7. set pathSig(cdPath)                "cwdSig"
  8. set pathComments(cwPath)        "CodeWarrior Compiler"
  9. set pathSig(cwPath)                "cwSig"
  10. set pathComments(mailPath)        "Eudora Path"
  11. set pathComments(excaliburPath)    "Excalibur Spellchecker"
  12. set pathComments(macperlPath)    "MacPerl"
  13. set pathComments(perlFilterPath)     "MacPerl Text Filters folder"
  14. set pathComments(perlDocs)         "MacPerl documentation folder"
  15. set pathComments(perlLib)         "MacPerl lib folder"
  16. set pathComments(referencePath)    "Think Reference"
  17. set pathComments(tassPath)        "Toolbox Assistant"
  18. set pathComments(kodexPath)        "Kodex C Pretty Printer"
  19. set pathComments(enscriptorPath) "Enscriptor Fancy Printer"
  20. set pathComments(droppsPath)    "DropÑPS"
  21. set pathComments(symPath)        "Symantec Project Manager"
  22. set pathComments(symDbgPath)    "Symantec Debugger"
  23.  
  24.  
  25. set tmp {}
  26. foreach n [array names pathComments] {
  27.     lappend tmp $pathComments($n)
  28. }
  29. menu -n appPaths -m -p pathProc [lsort $tmp]
  30. unset tmp
  31.  
  32.  
  33. #===============================================================================
  34.  
  35. proc pathProc {menu comment} {
  36.     global pathComments modifiedVars pathSig pathUseIC
  37.  
  38.     foreach path [array names pathComments] {
  39.         if {$pathComments($path) == $comment} {
  40.             global $path                
  41.             if {[info exists $path]} {
  42.                 set buttons {OK Change Remove Launch}
  43.                 if {[info exists pathUseIC($path)]} {
  44.                     lappend buttons "IConfig"
  45.                 }
  46.                 set val [set $path]
  47.             } else {
  48.                 set buttons {OK Set Remove}
  49.                 set val {}
  50.             }
  51.             
  52.             set res [eval [list buttonAlert "$pathComments($path):\r$val"] $buttons]
  53.  
  54.             switch $res {
  55.                 "Set"        "-"
  56.                 "Change"     {     if {[regexp -nocase {.*folder.*} $pathComments($path)]} {
  57.                                     set $path [get_directory -p "Select $pathComments($path):"]
  58.                                 } else {
  59.                                     set $path [getfile "Select $pathComments($path):"]
  60.                                 }
  61.                 
  62.                                 lappend modifiedVars $path
  63.                                 if {[info exists pathSig($path)]} {
  64.                                     global $pathSig($path)
  65.                                     set $pathSig($path) [getFileSig [set $path]]
  66.                                     lappend modifiedVars $pathSig($path)
  67.                                 }
  68.                 }
  69.                 "Remove"    { set $path {} }
  70.                 "Launch"    { launch -f  [set $path] }
  71.                 "IConfig" {
  72.                     if {[askyesno "Set '$path' from 'Internet Config'?"] == "yes"} {
  73.                         if {[catch {icGetPref -t 1 $pathUseIC($path)} npath]} {
  74.                             alertnote "Internet Config Error (installed?)"
  75.                         } else {
  76.                             message $npath
  77.                             set $path $npath
  78.                             lappend modifiedVars $path
  79.                             if {[info exists pathSig($path)]} {
  80.                                 global $pathSig($path)
  81.                                 set $pathSig($path) [getFileSig [set $path]]
  82.                                 lappend modifiedVars $pathSig($path)
  83.                             }
  84.                         }
  85.                     }
  86.                 }
  87.             }
  88.             return
  89.         }
  90.     }
  91. }
  92.